package cn.liuhuan1;

//import cn.liuhuan1.controller.testInt;
import cn.liuhuan1.api.CacluFeignClient;
import cn.liuhuan1.entity.ReturnResult;
import cn.liuhuan1.webModelBean.api.UserImp;
import cn.liuhuan1.webModelBean.vo.UserVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.servlet.ModelAndView;

/**
 * @Auther: liuhuan
 * @Date: 2021/1/21 - 01 - 21 - 16:00
 * @Description:
 * @version: 1.0
 */
@RestController
@RequestMapping("/user")
public class TestRedis {
//    @Autowired
//    cn.liuhuan1.controller.testInt testInt;

    @Autowired
    CacluFeignClient cacluFeignClient;

    @Autowired
    RestTemplate restTemplate;

    @Autowired
    private UserImp userImp;

    @RequestMapping(value = "/login",method = RequestMethod.POST)
    @ResponseBody
    public ReturnResult test(String username, String password, ModelAndView model){
        model.addObject("hello word");
//        System.out.println("web");
//        ResponseEntity<String> forEntity = restTemplate.getForEntity("http://SERVICE-REDIS/test/redisCode", String.class);
//        String caclulate = cacluFeignClient.caclulate();
//        System.out.println(caclulate);
        System.out.println(username);
        System.out.println(password);
        return ReturnResult.succes("hellow","212");
    }

    @RequestMapping(value = "/loginInfo",method = RequestMethod.POST)
    @ResponseBody
    public ReturnResult selectByName(String token){
            System.out.println(token);
        if(token.equals("212")){
            return ReturnResult.succes();
        }else{
            return ReturnResult.error();
        }
    };
}
